<?php
	class User_model extends CI_Model
	{
		function __construct()
		{
			// Call the Model constructor
			parent::__construct();
		}
		
		public function get_user( $userID )
		{
			$query = $this->db->get_where('User', array('UserID' => $userID));
			$toReturn = $query->result_array();
			return $toReturn[0];
		}
		
		public function get_user_username( $userName )
		{
			$query = $this->db->get_where('User', array('UserName' => $userName));
			$results = $query->result_array();
			if( count($results) > 0 )
			{
				return $results[0];
			}
			else 
			{
				return NULL;
			}
		}
		
		public function set_sessionID_for_user($userID, $sessionID)
		{
			$this->db->where('UserID', $userID);
			$this->db->update('User', array('sessionID'=>$sessionID));
		}
	}
?>